package com.woniuxy.joylifeshop.configuration;

import com.alipay.easysdk.kernel.BaseClient.Config;

public class AliConfiguration {

    public static Config getOptions() {
        Config config = new Config();
        config.protocol = "https";
        config.gatewayHost = "openapi.alipay.com";
        config.signType = "RSA2";

        config.appId = "2016101900725119";

        // 为避免私钥随源码泄露，推荐从文件中读取私钥字符串而不是写入源码中
        config.merchantPrivateKey = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCXMfn5xZ+mbVMzljS/6P2/be+p4pK8t36YVwMb+1QxZVkE7V3w/GxPWSdx2Mth6ENwelWfiknjwQy4wx2PnOxLA4wXJb46y6oROOWCeD8EiWkf5UJFLZE8lw+kObaHmwczjLNGpAnpAZlUMNnWZvd5MMbMukZ1+ALXniD+cdT24bsgK/ExEsetO/qKEoWyfsmWITnGmQ3XJhLaHSJEXxXDwkONcOLO3l42/8K1sv0m1wFpCX7L7ul+8+YnuFj113LA1yXiUnYzUQ4a5+y9k/Uo/JuycCjC1vDXbF0hHAU9rsJItOV5kAxXPyr55gEhF9P6dBneOzBvcd0xlhW3YjsLAgMBAAECggEANFIoFiYsTDRy4VwuXubqwI7zq89rRgEdvuwFeG5twTY4KvtVUeqYNJE+lCgYoYX1qHu9G5uIXFdW5q0mkqcUIhVVKkF2ZfRKovEUgyTHcfN3PIFigHv3UYdY81TBdIXSZSVgeKaVg1t5SugoyggRxY96jCg9797mZOUkt8h+kPwdY1oXN/XowCszaVaUjyUMnwmdAjP99X0clb3+d06zUuLtPjLDuWCjvZ7EpG/CRKKvI5j/TnOzIpWfEY3m+cz8m8N5eqqynpOUDRgjjicj0HEGv11xaLk9DPple8Oi/4pbvjS5rM6yp4oSzKab7avNtQ0r2lsDwLE6Rk/kZva/qQKBgQDdKUU8ILvcRewmFazLXlZ6Jaew1iU+C1KOVvyh5LAm6ZB4RJL6546PfuzNrzONEXMJ5Yu03JuThQp6S6Ov6O7ndK1nnxwtYSEjm6S21+zWskFernFu8wuJ5VrxYSTkL17oqKtafBDzFYE4IyeeKyTe+HTBKvyFG86I/+GaW+K9PwKBgQCvAzMe1OJiwB1pR9I9hUxmjl+65uQ3LWYRjp90eQuoF7jxjKmNmSCLHMeVmDLOnau3PJnxLZcF8PaTY2DzJeZ/E1DdVjUszRr4P+PDbCQlHfy02wpDwppV+jC6gRcIGKAGf/C18jz37pkLXAQmqD7jEqYJf286mNVhUORNC2KzNQKBgAHvA3D0JFBXuCnZFKquh3kH7UBpjufM94rRDeJoenXMovu6NcLF1YRBqtZdisjX9zaF8EPDjgSrLB1HngXCtpwFdCKszHVFHSIPkVAb8TErW9D1G37J1zb8b2Ae5lCsbVsBZoYjAY7uiDOycv06CVd9up+ZvZ14UcT238UWupPHAoGAbxJPylx/hP66a8vKMYM81sW7GcpZwm8MnU3wAyKjdD4CAUMthJFPZxqPzHA4porIpVVPuhIeDAY+55GlwQsnuzSOGLsSqmlNmYoqyicC1Y+vhzSQ0ipaewB7FpLBBEFkplticIbZjNyfwubWN5aFuuVl/Rckh4LhwY5uJjt4m5UCgYAXJdNHx1lS8ywgcOYjrFEzZspAx73XpFulWdOKAq5u3C10onsSR6nvHpP2SjGZSxPIJMcmui9xmuGy1mfskQ1tRw+eViImustICEgiHk7hHK4S3+/aytTo43I5ivkznnXZ5p/LeqIXnau/CpP9b/ELgE2//Du3WCdCRfXVLp7kZA==";

        //注：证书文件路径支持设置为文件系统中的路径或CLASS_PATH中的路径，优先从文件系统中加载，加载失败后会继续尝试从CLASS_PATH中加载
        //config.merchantCertPath = "<-- 请填写您的应用公钥证书文件路径，例如：/foo/appCertPublicKey_2019051064521003.crt -->";
        //config.alipayCertPath = "<-- 请填写您的支付宝公钥证书文件路径，例如：/foo/alipayCertPublicKey_RSA2.crt -->";
        //config.alipayRootCertPath = "<-- 请填写您的支付宝根证书文件路径，例如：/foo/alipayRootCert.crt -->";

        //注：如果采用非证书模式，则无需赋值上面的三个证书路径，改为赋值如下的支付宝公钥字符串即可
        config.alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqrM8zHJO44YXLjWaka31xHhk5AtlBAbbcDy8qoxZ9iDZIFSy8oipb6JZTH4l4T1m0y0KS0NPJ8vJzNTPZVAX3O+I1fYAYT/g8mLwJdL/1fOwr84RkmG8wHPBduwCRqM2oPTIjRqLPeFDVBQFd2pYPgBibGgFZOvSFBiMLNyL3/8S9NgIQEXh9W7g3wgxNaXBSKnRYibKgvAU938LSFEmmyklDMDxuNIwna6qr6gFpuGSkG3GqT5ytN8UT8/YHCFTdM9wo5RZ0kUdsjXKxcWXHWqy1cgpEecfDA6QDQHYOcv2v9Ip5Kx1q6nqJptgGB+WD9aOVMnOgb3Lm7721Sgf6QIDAQAB";

        //可设置异步通知接收服务地址（可选）
        //config.notifyUrl = "<-- 请填写您的支付类接口异步通知接收服务地址，例如：https://www.test.com/callback -->";

        //可设置AES密钥，调用AES加解密相关接口时需要（可选）
        //config.encryptKey = "<-- 请填写您的AES密钥，例如：aa4BtZ4tspm2wnXLb1ThQA== -->";

        return config;
    }

//    public static void main(String[] args) {
//        // 1. 设置参数（全局只需设置一次）
//        Factory.setOptions(getOptions());
//        try {
//            // 2. 发起API调用（以支付能力下的统一收单交易创建接口为例）
//            AlipayTradeCreateResponse response = Factory.Payment.Common().create("Apple iPhone11 128G",
//                    "2234567890", "5799.00", "2088002656718920");
//            // 3. 处理响应或异常
//            if ("10000".equals(response.code)) {
//                System.out.println("调用成功");
//            } else {
//                System.err.println("调用失败，原因：" + response.msg + "，" + response.subMsg);
//            }
//        } catch (Exception e) {
//            System.err.println("调用遭遇异常，原因：" + e.getMessage());
//            throw new RuntimeException(e.getMessage(), e);
//        }
//    }

}
